package com.vcs.domain;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
@Table(name = "job_applications")
@SuppressWarnings("serial")
public class JobApplication implements Serializable, Comparable<JobApplication> {

	private Long id;
	private Long jobId;
	private Long jobseekerId;
	private java.util.Date appliedOnDate;

	public JobApplication() {
		// TODO Auto-generated constructor stub
	}

	@Id
	@GeneratedValue
	@Column(name = "id")
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@Column(name = "job_id")
	public Long getJobId() {
		return jobId;
	}

	public void setJobId(Long jobId) {
		this.jobId = jobId;
	}

	@Column(name = "jobseeker_id")
	public Long getJobseekerId() {
		return jobseekerId;
	}

	public void setJobseekerId(Long jobseekerId) {
		this.jobseekerId = jobseekerId;
	}

	@Column(name = "applied_on_date")
	@Temporal(TemporalType.TIMESTAMP)
	public java.util.Date getAppliedOnDate() {
		return appliedOnDate;
	}

	public void setAppliedOnDate(java.util.Date appliedOnDate) {
		this.appliedOnDate = appliedOnDate;
	}

	@Override
	public String toString() {
		return "JobApplication [id=" + id + ", jobId=" + jobId
				+ ", jobseekerId=" + jobseekerId + ", appliedOnDate="
				+ appliedOnDate + "]";
	}

	@Override
	public int compareTo(JobApplication other) {
		if (this.jobId > other.jobId) {
			return 1;
		} else if (this.jobId < other.jobId) {
			return -1;
		} else {
			return 0;
		}
	}
}
